package com.shunwang.errors.engine.exception;

public abstract class BussException extends Exception {

	protected Integer code = -1;
	protected String msg = "BussException";
    public BussException(){
        super();
        initState();
    }
    
    public BussException(String ex){
        super(ex);
        initState();
    }
    
    public BussException(String ex,Throwable cause){
        super(ex, cause);
        initState();
    }
    
    public BussException(Throwable cause){
        super(cause);
        initState();
    }
    
    public Integer getReturnCode(){
        return code;
    }
    
    public String getReturnString(){
        return msg;
    }

	public boolean equals(Object obj) {
		if(!(obj instanceof BussException)){
			return false;
		}
		if(obj.hashCode() != this.hashCode()){
			return false;
		}
		return true;
	}

	@Override
	public int hashCode() {
		return this.code+this.msg.hashCode();
	}
	
	public abstract void initState();
    
}
